<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>易抽奖-我的抽奖</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="index.css" type="text/css">
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>

<body>
<div class="container">
    <div class="row">
        <div class="col-lg-3 visible-xs-*"></div>
        <div class=" box col-lg-6 " style="background-color:#DCDCDC;"><br>
            <div align="center">
                <p class="button3">我创建的抽奖</p></div>
            <div id="myHolding"></div>
            <br><br><br><br>
            <div class="col-lg-3 visible-xs-*"></div>
        </div>
    </div>
</div>
</body>
<script>
    $(document).ready(function () {
        var kuang_id = 0;

        //绘制单个div
        function setDiv(item) {
            var div = '<div class="kuang1"  data-i="'
                + item.id + ' '
                + ' "><div class="listpicright"><div class="listgiftleft"><p class="font-center"><p class="font-center">'
                + item.lotteryname
                + '</p></div></div>'
                + '</div>'
            return div
        }

        // 展示我创建的抽奖
        $.get("http://yb.upc.edu.cn:8084/lottery/user/pass",
            {
                Authorization: localStorage.getItem("testtoken")
            },
            function (data) {
                var html = ''
                for (var i = 0; i < data.object.length; i++) {
                    html += setDiv(data.object[i])
                }
                document.getElementById("myHolding").innerHTML = html

                $('.kuang1').click(function () {
                    kuang_id = $(this).attr('data-i')
                    window.open("mylottery.html?id=" + kuang_id + "")
                })
            }
        );
    })
</script>
</html>